<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  <style>
    .masonry{
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      /* grid-template-rows: repeat(3 1fr); */
      grid-auto-rows: auto;
      column-gap: 5px;
      font-size: 30px;
    }
    .item:first-child{
      /* grid-row-start: 1;
      grid-row-end: 3;
      grid-column-start: 1;
      grid-column-end: 3; */
      grid-row-start: auto;
      grid-row-end: span 3;
    }
    .item:nth-child(2){
      grid-row-start: auto;
      grid-row-end: span 5;
    }

  </style>
</head>

<body>
  <div id="app">
    <div class="masonry">
      <div class="item" v-for="n in 9" :style="getStyle(n)">{{n}}</div>
    </div>
  </div>

  <script>
    const { createApp, ref } = Vue

    createApp({
      setup() {
        const heights = [150, 160, 170, 180, 140, 155, 165, 180, 175]
        const colors = [
          "#ef3429",
          "#f68f25",
          "#4ba846",
          "#0476c2",
          "#c077af",
          "#f8d29d",
          "#b4a87f",
          "#d0e4a8",
          "#4dc7ec"
        ]

        const getStyle = (index) => {
          return {
            height: heights[index - 1] + "px",
            backgroundColor: colors[index - 1]
          }
        }

        return {
          heights,
          colors,
          getStyle
        }
      }
    }).mount('#app')
  </script>
</body>

</html>